{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}

{literal}

<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript" src="include/js/jquery.maskedinput.js" language="javascript"></script>

<script type="text/javascript">
    
$().ready(function() {            	
    var usuarioID = $("#usuarioID").val();
        
    $("#frmCadCliente").validate({
            rules: {
                login: {
                        required: true,
                        minlength: 5,
                        remote:{
                            url: "UsuarioAction.validaLogin",
                            type: "post",
                            data: {
                              usuarioID : usuarioID
                            }
                        }
                },
                senha: {
                        required: true,
                        minlength: 5
                },
                r_senha: {
                        required: true,
                        minlength: 5,
                        equalTo: "#senha"
                },
                email: {
                        required: true,
                        email: true,
                        remote:{
                            url: "UsuarioAction.validaEmail",
                            type: "post",
                            data: {
                              usuarioID : usuarioID
                            }
                        }
                },
                media: {
                        accept: "gif|jpg|jpeg|png"
                },
                cepEnd: {
                        required: true                                
                        },			
                logradouroEnd: {
                            required: true                                
                            },			
                numeroEnd: {
                            required: true                                
                            },
                bairroEnd: {
                            required: true                                
                            },			
                estadoEnd: {
                            required: true                                
                            },			
                cidadeEnd: {
                            required: true                                
                            },
                nome: {                        
                        required: true 
                },
                cpf: {                        
                        required: true 
                },
                dataNascimento: {                        
                        required: true 
                },
                estadoCivil: {                        
                        required: true 
                },
                telefone: {                        
                        required: true 
                },
                sexo: {                        
                        required: true 
                }
                    
    						
        }
    });
});
</script>
{/literal}

<div id="content" class="block-border">

    <div class="block-content">
        <div class="h1 with-menu"><h1>Cadastro de Clientes</h1></div>

        {msg obj=$msg|default:null type="small"}
        {display_errors errors=$errosValidacao|default:null}
        
        <div class="columns">

            <div class="colx1-left">
                <!-- Add the class 'form' -->
                <form id="frmCadCliente" action="ClienteAction.salvar" class="form" method="post" enctype="multipart/form-data">

                    <input type="hidden" name="usuarioID" id="usuarioID" value="{$usuarioID|default:0}" />

                    <fieldset>
                        <legend>Dados de Acesso</legend>				
                {include file="view/usuario/formSimples.tpl"}                                                
                        <p>
                            <input type="checkbox" name="avisosPorEmail"  id="avisosPorEmail" value="1" {if isset($avisosPorEmail) && $avisosPorEmail eq 1} checked="true" {/if}/>
                            <label for="avisosPorEmail" class="inline">Notificações Por Email</label>
                        </p>    
                    </fieldset>

                    <fieldset>
                        <legend>Imagem</legend>				
                {include file="view/media/formImagem.tpl"}                                                                                
                    </fieldset>

                    <fieldset>
                        <legend>Dados Pessoais</legend>			
                {include file="view/pessoa/formSimples.tpl"}                                                
                    </fieldset>

                    <fieldset>
                        <legend>Endereço</legend>			
                {include file="view/endereco/formSimples.tpl"}                                                
                    </fieldset>
                    <div class="btAction">			
			     {action_button label="Limpar" type="reset" class="grey"}
                 {action_button label="Salvar" type="submit"}
                    </div> 

                </form>
            </div>
        </div>
    </div>





</div>

{include file="layout/footer.tpl"}
